package com.hzjh.h5mall.adapter.wallet

import com.hzjh.base.ext.data.Configs
import com.hzjh.base.ext.route.RouteUrl
import com.hzjh.base.frame.adapter.BaseBindingVH
import com.hzjh.base.router.ext.navigationTo
import com.hzjh.base.utils.function.dp2px
import com.hzjh.base.utils.other.ScreenUtils
import com.hzjh.h5mall.BuildConfig
import com.hzjh.h5mall.bean.wallet.WalletClassBean
import com.hzjh.h5mall.databinding.ItemWalletClassBinding

class WalletClassTypeVH(binding:ItemWalletClassBinding) : BaseBindingVH<WalletClassBean, ItemWalletClassBinding>(binding) {
    init {
        val width = (ScreenUtils.getScreenWidth2()-38.dp2px()) / 3.0
        binding.rlContentItem.layoutParams.width = width.toInt()
    }
    override fun onBind(model: WalletClassBean, position: Int) {
        binding.ivClassTag.setImageResource(model.imgResource)
        binding.tvPriceItem.show(model.price)
        binding.tvClassnameItem.text=model.className
        itemView.setOnClickListener {
            navigationTo(RouteUrl.WEB_ACTIVITY){
                withString(RouteUrl.PARAMS_WEB_URL, BuildConfig.h5Url+ Configs.PROFIT_ORDER_LIST_URL + model.type)
                withBoolean(RouteUrl.PARAMS_WEB_BAR_VISIBILITY,false)
                withBoolean(RouteUrl.PARAMS_WEB_TITLE_BAR_VISIBILITY,false)
            }
        }
    }
}